package org.dom4j.tree;

import java.util.List;

import org.dom4j.CharacterData;
import org.dom4j.Element;
import org.dom4j.Node;

public abstract class DefaultCharacterData implements CharacterData {
  String text;
  Element parent;
  
  DefaultCharacterData(Element parent, String text) {
    this.parent = parent;
    this.text = text;
  }

  public void appendText(String text) {
    this.text += text;
  }

  public Node detach() {
    getParent().remove(this);
    return this;
  }

  public List selectNodes(String xpath) {
    throw new UnsupportedOperationException();
  }

  public Node selectSingleNode(String xpath) {
    throw new UnsupportedOperationException();
  }

  public String getText() {
    return text;
  }

  public void setText(String text) {
    this.text = text;
  }

  public Element getParent() {
    return parent;
  }

  public void setParent(Element element) {
    this.parent = parent;
  }
  
}
